package com.ds.components.builders;
/* Copyright (C) 2006, 2007 by Daniel Gheorghian
 All rights reserved
 
 Use and distribute freely, except: don't remove my name from the source or documentation 
 (don't take credit for my work), mark your changes (don't get me blamed for your possible bugs),
 don't alter or remove this notice.
 
 No warrantee of any kind, express or implied, is included with this software; use at your
 own risk, responsibility for damages (if any) to anyone resulting from the use of this
 software rests entirely with the user.
 
 Send bug reports, bug fixes, enhancements, requests, flames, etc., and I'll try to keep 
 a version up to date.  I can be reached at: daniel.gheorghian@gmail.com
*/

import com.ds.components.bars.ElbowBar;
import com.ds.components.composite.PanelBar;

import javax.swing.*;
import java.awt.*;

public class PanelBarPanelBuilder extends AbstractBuilder<PanelBar>
{
	public JPanel elbowPanel = new JPanel();
	public ElbowBarBuilder    elbowBarBuilder    = new ElbowBarBuilder();
	public JPanel contentsPanel = new JPanel();

	@Override
	public PanelBar build()
	{
		PanelBar bar = new PanelBar();

		bar.topElbowBar = this.elbowBarBuilder.build();
		bar.bottomElbowBar = this.elbowBarBuilder.build();
		bar.elbowPanel = this.elbowPanel;
		bar.panel = this.contentsPanel;

		bar.topElbowBar.setBarLayout( ElbowBar.TOP );
		bar.bottomElbowBar.setBarLayout( ElbowBar.BOTTOM );

		this.elbowPanel.setBackground( Color.black );
		this.elbowPanel.setPreferredSize( new Dimension( bar.topElbowBar.getConnectorSize() + 2 * bar.topElbowBar.getBorderSize(),
				                                         this.elbowPanel.getHeight() ) );
		this.elbowPanel.setLayout( new FlowLayout( FlowLayout.CENTER,
				                                   bar.topElbowBar.getBorderSize(),
				                                   bar.topElbowBar.getBorderSize() ) );
		return bar;
	}
}
